$('#flooropen').on('click', floorOpen);
$('#floorclose').on('click', floorClose)


function floorOpen(){
    //outdoorTest
    viewer.entities.removeAll();
    if(viewer.scene.primitives._primitives[1]){
        viewer.scene.primitives.remove(viewer.scene.primitives._primitives[1])
    };
    viewer.scene.scanEffect.show = false;
    //
    var layer_lower = viewer.scene.layers.find("F0@听海大道地下空间20201016#1");
    var layer_upper = viewer.scene.layers.find("F1@听海大道地下空间20201016");
    layer_upper.visible = true;

    $('#flooropen').addClass('hide');
    $('#floorclose').removeClass('hide');

    var ids = get_arr(0, 2000);
    var offsetZ1 = 0;
    
    setTimeout(function(){
        var pTime = 0;
        var pTimeId_3 = setInterval(function(){
            if (pTime == 120){
                clearInterval(pTimeId_3);
            }
            layer_lower.selectedTranslate = new Cesium.Cartesian3(0,0, -20 + offsetZ1/1.5);
            layer_lower.setObjsOffset(ids);
            layer_upper.selectedTranslate = new Cesium.Cartesian3(0,0, -20 + offsetZ1);
            layer_upper.setObjsOffset(ids);
            offsetZ1 += 1;
            pTime++;
        }, 1)
    }, 200);
}

function floorClose(){
//隐藏
//-- 室内模型应用界面
$('#firestart').addClass('hide');
$('#escape').addClass('hide');
$('#pathplanning').addClass('hide');
$('#floorclose').addClass('hide');
$('#startfly').addClass('hide');
$('#routefly').addClass('hide');
$('#stopfly').addClass('hide');


//清除动画效果
clearInterval(pointTimeId);
clearInterval(path_fly);
clearInterval(path_fly_2);
    //清除重复点击的跟随漫游
    //存在崩溃问题
clearInterval(follow_path_fly);

//打开
//-- 中型城市模型应用界面 
setTimeout(function(){    
    $('#sceneopen').removeClass('hide');
    $('#sceneopen_2').removeClass('hide');
    $('#sceneopen_3').removeClass('hide');
    $('#sceneopen_4').removeClass('hide');
},3500)

//进入 [前海城市模型 - 桂湾段] 初始视角 
setTimeout(citySpot,1000)


    //outdoorTest
    viewer.entities.removeAll();
    if(viewer.scene.primitives._primitives[1]){
        viewer.scene.primitives.remove(viewer.scene.primitives._primitives[1])
    };
    viewer.scene.scanEffect.show = false;
    
    var layer_lower = viewer.scene.layers.find("F0@听海大道地下空间20201016#1");
    var layer_upper = viewer.scene.layers.find("F1@听海大道地下空间20201016");
    
    var ids = get_arr(0, 2000);
    var offsetZ2 = 0;
    setTimeout(function(){
        var pTime = 0;
        var pTimeId_4 = setInterval(function(){
            if (pTime == 120){
                clearInterval(pTimeId_4);
            }
            layer_lower.selectedTranslate = new Cesium.Cartesian3(0,0, 60+offsetZ2/1.5);
            layer_lower.setObjsOffset(ids);
            layer_upper.selectedTranslate = new Cesium.Cartesian3(0,0, 100+offsetZ2);
            layer_upper.setObjsOffset(ids);
            offsetZ2 -= 1;
            pTime++;
        }, 1)
    }, 200);

    //模型隐藏后恢复上盖
    setTimeout(function(){
        layer_upper.visible = true;
    },3500);



}

// function get_arr(starer, n) {
//     var ret_arr = [];
//     for (var i = starer; i < starer + n + 1; i++) {
//         ret_arr.push(i);
//     }
//     return ret_arr;
// }; 